package com.me.study.jdk8.builder;

import spring.validation.Person;
import com.me.common.util.CommonBuilder;

/**
 * JDK8 通用builder 测试
 *
 * @author ME
 * @date   2020/1/16
 */
public class TestCommonBuilder {

    public static void main(String[] args) {
        Person person = CommonBuilder.of(Person::new)
            .with(Person::setName, "小美")
            .with(Person::setAge, "18")
            .with((person1, hobby) -> {
                person1.addHobby(hobby);
            }, "逛街")
            // .with(Person::addHobby, "逛街")
            .with(Person::addHobby, "购物")
            .with(Person::addHobby, "买东西")
            .build();
        System.out.println(person);
    }
}
